CC=g++
CFLAGS= -Wall
LFLAGS= -lrt -lutil

#This is section for source files
SRC_DLM= dlm.c
SRC_CLIENT= client.c
SRC_COMMON= common.c
SRC_DLMLISTS= dlmlists.cpp
SRC_DLM_API = dlm_api.c

OBJS= common.o dlmlists.o dlm_api.o

all: common dlm_api dlmlists dlm client 

dlm: $(SRC_DLM)
	$(CC) $(CFLAGS) $(LFLAGS) $(OBJS) $(SRC_DLM) -o dlm
	
client: $(SRC_CLIENT)
	$(CC) $(CFLAGS) $(LFLAGS) $(OBJS) $(SRC_CLIENT) -o client
	
common: $(SRC_COMMON)
	$(CC) $(CFLAGS) $(LFLAGS) $(SRC_COMMON) -c

dlmlists: $(SRC_DLMLISTS)
	$(CC) $(CFLAGS) $(LFLAGS) $(SRC_DLMLISTS) -c

dlm_api: $(SRC_DLM_API)
	$(CC) $(CFLAGS) $(LFLAGS) $(SRC_DLM_API) -c
	
clean:
	rm -f *.o
	rm -f dlm
	rm -f client
	
rebuild:
	clean all
